package cz.proks.schoolpupilbook.gwt.widget.common;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Widget;

public class LoggedUserPanel extends Composite {

	@UiTemplate("LoggedUserPanel.ui.xml")
	interface LoggedUserPanelUiBinder extends UiBinder<Widget, LoggedUserPanel> {
	}
	
	private static LoggedUserPanelUiBinder uiBinder = GWT.create(LoggedUserPanelUiBinder.class);
	
	@UiField Hyperlink userHyperlink;	
	@UiField Hyperlink logoutHyperlink;

	public LoggedUserPanel() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	public LoggedUserPanel(String firstName) {
		initWidget(uiBinder.createAndBindUi(this));	
	}
	
	public String getUserFullName() {
		return userHyperlink.getText();
	}
	
	public void setUserFullName(String userFullName) {
		userHyperlink.setText(userFullName);
	}
	
	public void setVisibleUserLink(boolean value) {
		userHyperlink.setVisible(value);
	}
}
